//play点击事件
function play() {
    var rul = document.getElementById("url").value; //获取input链接
    if(rul == "") {
        alert("恭喜发现彩蛋....");
        var obj = document.getElementById("jk"); //定位id
        var index = obj.selectedIndex; // 选中索引
        var text = obj.options[index].text; // 选中文本
        var value = obj.options[index].value; // 选中值
        var srcsoures=value+rul;
        $("#palybox").attr('src',srcsoures);
    } else {
        var obj = document.getElementById("jk"); //定位id
        var index = obj.selectedIndex; // 选中索引
        var text = obj.options[index].text; // 选中文本
        var value = obj.options[index].value; // 选中值
        var srcsoures=value+rul;
        $("#palybox").attr('src',srcsoures);
        srcsoures="";
    }
}

//远程连接全屏
function playFullscreen() {
    //toggleFullscreen();
    /* 获取父类的document */
    var parentDoc = parent.document;
    /* 定义一个接收元素的变量 */
    var thisIframe = null;
    /* 用jQuery遍历父类的所有iframe,找到我引入的那个iframe,假设我不知道是哪个页面要引入我的iframe,但是引入我的iframe的src肯定会有引入这个页面的名字,27      所以通过这个去检索,一定能找到引入这个页面的iframe,然后把这个iframe的元素全屏化也就是把原来的页面全屏化 */
    $("iframe",window.parent.document).each(function(index,e){
        if (e.src.indexOf("index.html") > 0) {//以index.html结尾的也没全屏
            thisIframe = e;
            return false;
        }else{
            thisIframe = e;
            return false;
        }
    });
    requestFullScreen(thisIframe);
    $("#font").empty();
    $("#font").text("已打开全屏化");
}

//当前网页全屏---暂无使用
var toggleFullscreen = function(){
    if(document.fullscreenElement ||
        document.mozFullScreenElement ||
        document.webkitFullscreenElement ||
        document.msFullscreenElement){
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitExitFullscreen) {
            document.webkitExitFullscreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
    }else{
        if (document.documentElement.requestFullscreen) {
            document.documentElement.requestFullscreen();
        } else if (document.documentElement.mozRequestFullScreen) {
            document.documentElement.mozRequestFullScreen();
        } else if (document.documentElement.webkitRequestFullscreen) {
            document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
        } else if (document.body.msRequestFullscreen) {
            document.body.msRequestFullscreen();
        }
    }

}



function requestFullScreen(element) {
    var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
    if (requestMethod) {
        requestMethod.call(element);
    } else if (typeof window.ActiveXObject !== "undefined") {
        var wscript = new ActiveXObject("WScript.Shell");
        if (wscript !== null) {
            wscript.SendKeys("{F11}");
        }
    }
}